//测试-数组
//编译：g++ TestArray.cpp ../../*/*/Array.hpp ../../*/ExceptionDefinition.hpp -o test
#ifndef __TESTARRAY__CPP
#define __TESTARRAY__CPP

#include<iostream>
#include"../../DataStructure/Array/Array.hpp"
#include"../../DataStructure/ExceptionDefinition.hpp"

using namespace std;
using namespace NgSiuKei;

int main(void) {
    //初始化
    Array<int> *temp = new Array<int>(2);
    //元素赋值
    cout << "赋值" << endl;
    try {
        (*temp)[0] = 5;
        cout << "array[0] = 5" << endl;
        (*temp)[1] = 10;
        cout << "array[1] = 10" << endl;
    }
    catch (Exception & exception) {
        printException(exception);
        return 0;
    }
    //数组复制
    Array<int> * array1 = new Array<int>(*temp);
    Array<int> array2 = *temp;
    //数组大小
    cout << "数组大小：" << array1->getSize() << endl;
    //获取：at
    cout << "获取：at" << endl;
    try {
        cout << "array1->at(0) = " << array1->at(0) << endl;
        cout << "array1->at(1) = " << array1->at(1) << endl << endl;
    }
    catch (Exception & exception) {
        printException(exception);
        return 0;
    }
    //获取：[]
    cout << "获取：[]" << endl;
    try {
        cout << "array2[0] = " << array2[0] << endl;
        cout << "array2[1] = " << array2[1] << endl << endl;
    }
    catch (Exception & exception) {
        printException(exception);
        return 0;
    }
    //打印
    array2.print();
    
    return 0;
}

#endif